package com.hlb.zh.dao;

import com.hlb.zh.pojo.Employee;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Administrator on 2016/12/17.
 */
@Repository
public class EmployeeDao {
    @Autowired
    private SessionFactory sessionFactory;
    private Session getSession(){
        return sessionFactory.openSession();
    }
    public List<Employee> findAll(){
        String hql="from Employee";
        return getSession().createQuery(hql).list();
    }
}
